package com.xiaoxu.test.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.xiaoxu.common.entity.AbstractEntity;

import javax.persistence.*;
import java.util.List;

/**
 * @Description Student
 * @Author xuanbao
 * @Date 2022/8/19 13:35
 */
@Entity
@Table(name = "test_student")
public class Student extends AbstractEntity {
	private String studentName;
	@OneToOne(targetEntity=Card.class, cascade= CascadeType.ALL)
	@JoinColumn(name = "card_id", unique = true)
	private Card studentCard;
	@ManyToMany(mappedBy = "students", cascade = CascadeType.ALL)
	@JsonIgnore
	private List<Clazz> clazzes;

	public String getStudentName() {
		return studentName;
	}

	public void setStudentName(String studentName) {
		this.studentName = studentName;
	}

	public Card getStudentCard() {
		return studentCard;
	}

	public void setStudentCard(Card studentCard) {
		this.studentCard = studentCard;
	}

	public List<Clazz> getClazzes() {
		return clazzes;
	}

	public void setClazzes(List<Clazz> clazzes) {
		this.clazzes = clazzes;
	}
}
